package com.kx.springmvc.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * @ClassName UserController
 * @Author Sun
 * @Date 2021/5/20 20:44
 */
@RestController
@RequestMapping("/users")
public class UserController {
    private Random random = new Random();

    @RequestMapping("/exp1")
    public String exception1() {
        int random = this.random.nextInt(3);
        if (random == 0) {
            int i = 1 / 0;
        }
        return "exp1";

    }

    @RequestMapping("/exp2")
    public String exception2() {
        int random = this.random.nextInt(3);
        if (random == 0) {
            String s = null;
            s.toLowerCase();
        }
        return "exp2";
    }
}